#!/usr/local/bin/python
# -*- coding: gbk -*-
#============================================================
# GIFSAVE.PY                 -- by Dr. ZhuoQing 2020-01-24
#
# Note:
#   GIFSAVE 0(any other ): Delete temp gif file
#           1: Delete any picture(.JPG,.BMP..GIF)
#
#============================================================

from head import *

#------------------------------------------------------------
tempdir = r'd:\temp'

if len(sys.argv) > 1:
    if sys.argv[1] == 'a' or sys.argv[1] == '1':
        filedim = os.listdir(tempdir)
        for f in filedim:
            ext = os.path.splitext(f)[1].upper()
            if len(ext) > 0:
                if ext == '.GIF' or ext == '.BMP' or ext == '.JPG':
                    os.remove(os.path.join(tempdir, f))

    elif sys.argv[1] == '0':
        filedim = os.listdir(tempdir)
        for f in filedim:
            ext = os.path.splitext(f)[1].upper()
            if len(ext) > 0:
                if ext == '.GIF':
                    os.remove(os.path.join(tempdir, f))

    exit()

#------------------------------------------------------------
gifid = tspgetidselect()
printf(gifid)

if len(gifid) < 1:
    exit()

dop2gif(gifid = gifid[0])




#------------------------------------------------------------
#        END OF FILE : GIFSAVE.PY
#============================================================
